{% extends "fitbeats/inline.html" %}

{% block extrahead %}
    {% if not is_done %}
        <meta http-equiv="refresh" content="1">
    {% endif %}
{% endblock %}

{% block content %}
    <div>
        <p>Generation: {{generation}}</p>
        {% if not is_done %}
            Running...
        {% else %}
            Done!
        {% endif %}
    </div>

    {% if best_pattern %}
        <table class="pattern_result" border=1>
            {% for row in best_pattern %}
                <tr>
                {% for column in row %}
                    {% if forloop.first %}
                        <th>{{column}}</th>
                    {% else %}
                        <td width="10px">{% ifequal column 1 %}x{% else %}&nbsp;{% endifequal %}</td>
                    {% endif %}
                {% endfor %}
                </tr>
            {% endfor %}
        </table>
        
        <div style="margin-top: 10px; margin-bottom: 10px;">
            <p>Best Fitness: {{fitness}}</p>
            <p>Population Fitness: {{population_fitness}}</p>
            <p>Diversity: {{diversity}}</p>
        </div>
        
        {% if pattern_instances.count %}
        <h3>Previously evolved pattern instances</h3>
        <ol style="">
            {% for p in pattern_instances %}
                <li><a href="{% url fitbeats.views.view_pattern_instance p.id %}">{{p.id}} - {{p.fitness}}</a></li>
            {% endfor %}
        </ol>
        {% endif %}
    {% endif %}
{% endblock %}
